#ifndef MYPUSHBUTTON_H
#define MYPUSHBUTTON_H

#include <QPushButton>

class MyPushButton : public QPushButton
{
    Q_OBJECT
public:
    enum class BntAction{
       normal = 0,
       hover = 1,
       press = 2
    };
    explicit MyPushButton(QWidget* parent = nullptr);
    explicit MyPushButton(const QString& normalImage,const QString& pressImage = "",const QString& hoverImage = "",QWidget *parent = nullptr);
    void        mousePressEvent(QMouseEvent* ev) override;
    void        mouseReleaseEvent(QMouseEvent* ev) override;
    void     setNormalImage(const QString& normalImage);
    void     setPressImage(const QString& pressImage);
    void     setHoverImage(const QString& hoverImage);
    void     setState(BntAction state);
    int      getState() const;
    virtual void enterEvent(QEvent *event) override;
    virtual void leaveEvent(QEvent *event) override;
    void paintEvent(QPaintEvent*);
public:
    int m_width;
    int m_height;
signals:
private:
    QString m_normalImage;
    QString m_pressImage;
    QString m_hoverImage;
    BntAction   m_action;
};

#endif // MYPUSHBUTTON_H
